﻿<UserControl x:Class="ScrumFactory.Windows.ProjectDetail"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:SF_Helpers="clr-namespace:ScrumFactory.Windows.Helpers;assembly=ScrumFactory.Windows.Helpers"
             xmlns:props="clr-namespace:ScrumFactory.Windows.Properties;assembly=ScrumFactory.Windows"
             xmlns:local="clr-namespace:ScrumFactory.Windows"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Border Grid.Row="0" HorizontalAlignment="Stretch"  x:Name="windowTitle" 
                                Padding="25,3,5,3"
                                BorderThickness="0,1,0,1" Background="#FAFAFA">
                            <Grid>
                                
                                <StackPanel Orientation="Horizontal">

                                    <TextBox FontWeight="SemiBold" Margin="0" Padding="0" Foreground="{StaticResource ItemGroupBrush}" Style="{StaticResource CleanTextBox}" IsReadOnly="True">
                                        <TextBox.Text>
                                            <MultiBinding StringFormat="{}{0} - {1} [{2}]">
                                                <Binding Mode="OneWay" Path="Project.ClientName"/>
                                                <Binding Mode="OneWay" Path="Project.ProjectName"/>
                                                <Binding Mode="OneWay" Path="Project.ProjectNumber"/>   
                                            </MultiBinding>
                                        </TextBox.Text>
                                    </TextBox>

                                    <Button 
                                        Style="{StaticResource OverButton}"
                                        Command="{Binding CopyProjectUrlCommand}"                                         
                                        VerticalAlignment="Stretch" ToolTip="{x:Static props:Resources.Copy_project_url_to_clipboard}">
                                        <Image Source="/Images/Toolbar/tag.png" Width="16" Height="16" Margin="5,0,5,0" VerticalAlignment="Center"/>
                                    </Button>


                                    <Button 
                                        Command="{Binding ShowDocRepositoryCommand}"                                         
                                        VerticalAlignment="Stretch" ToolTip="{Binding Project.DocRepositoryPath}" Margin="0">
                                        <Image Source="/Images/Buttons/DocRep.png" Width="16" Height="16" Margin="5,0,5,0" VerticalAlignment="Center"/>
                                        <Button.Style>
                                            <Style BasedOn="{StaticResource OverButton}" TargetType="Button">
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding Project.DocRepositoryPath}" Value="{x:Null}">
                                                        <Setter Property="Visibility" Value="Collapsed"/>
                                                    </DataTrigger>
                                                    <DataTrigger Binding="{Binding Project.DocRepositoryPath}" Value="">
                                                        <Setter Property="Visibility" Value="Collapsed"/>
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </Button.Style>
                                    </Button>


                                    <Button 
                                        Command="{Binding ShowCodeRepositoryCommand}"                                         
                                        VerticalAlignment="Stretch" ToolTip="{Binding Project.CodeRepositoryPath}">
                                        <Image Source="/Images/Buttons/CodeRep.png" Width="16" Height="16" Margin="5,0,5,0" VerticalAlignment="Center"/>
                                        <Button.Style>
                                            <Style BasedOn="{StaticResource OverButton}" TargetType="Button">
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding Project.CodeRepositoryPath}" Value="{x:Null}">
                                                        <Setter Property="Visibility" Value="Collapsed"/>
                                                    </DataTrigger>
                                                    <DataTrigger Binding="{Binding Project.CodeRepositoryPath}" Value="">
                                                        <Setter Property="Visibility" Value="Collapsed"/>
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </Button.Style>
                                    </Button>

                                  
                                </StackPanel>
                                
                                
                                
                                
                                <local:SprintIndicator DataContext="{Binding Project}" HorizontalAlignment="Right" Margin="0,0,50,0" />
                            </Grid>
                            
                        </Border>
        <SF_Helpers:DockWindowContainer Grid.Row="1">

            <!-- PROJECT PANELS -->
            <TabControl                                                                
            Margin="0,0,0,0"
            Background="Transparent"
            x:Name="projectPanels"                               
            ItemsSource="{Binding ProjectPanels}"                    
            SelectedItem="{Binding SelectedProjectTab}"
            DisplayMemberPath="PanelName"     
            Style="{StaticResource WindowTabControl}"                        
            VerticalAlignment="Stretch">
                <TabControl.ContentTemplate>
                    <DataTemplate>
                        <Border Background="{StaticResource PanelBackgroundBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                            <ContentPresenter Content="{Binding View}" />
                        </Border>
                    </DataTemplate>
                </TabControl.ContentTemplate>
            </TabControl>
        </SF_Helpers:DockWindowContainer>
    </Grid>
    
    
</UserControl>
